package Test;

/**
 * @author feng
 * @Date 2021/9/22 12:57
 */
public class Test04 {
    public static void main(String[] args) {
        int[] array = new int[10];
        //赋值
        for (int i = 0; i < array.length; i++) {
            array[i] = i;
        }
        //
        for (int i = 0; i <array.length ; i++) {
            System.out.print(array[i]+" ");
        }

        //元素位置互换
        for (int i = 0, j = array.length - 1; i < array.length; i++, j--) {

            if (i > j) {
                break;
            }
            int tmp;
            tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;

        }

        for (int i = 0; i <array.length ; i++) {
            System.out.print(array[i]);
        }

    }
}
